package cn.highset.redis.service;

import cn.highset.redis.base.CacheExceptionConstant;
import org.apache.commons.lang3.StringUtils;

/**
 * @author gg
 * @version RedisBaseService.java, v 0.1 2019-04-11 17:00 gg
 */
class RedisBaseService {

    void checkKey(String key) {
        if (StringUtils.isBlank(key)) {
            throw new IllegalArgumentException(CacheExceptionConstant.KEY_NOT_NULL);
        }
    }

    void checkPattern(String pattern) {
        if (StringUtils.isBlank(pattern)) {
            throw new IllegalArgumentException(CacheExceptionConstant.PATTERN_NOT_NULL);
        }
    }

    void checkOtherKey(String otherKey) {
        if (StringUtils.isBlank(otherKey)) {
            throw new IllegalArgumentException(CacheExceptionConstant.OTHER_KEY_NOT_NULL);
        }
    }

    void checkDestKey(String otherKey) {
        if (StringUtils.isBlank(otherKey)) {
            throw new IllegalArgumentException(CacheExceptionConstant.DEST_KEY_NOT_NULL);
        }
    }
}